import 'package:flutter/material.dart';

class SafetyTrainingItem extends StatelessWidget {
  final String time;
  final String name;
  final String curriculum;
  final String? fraction;
  final Color? fractionColor;
  final EdgeInsetsGeometry padding;

  const SafetyTrainingItem(
      {super.key,
      required this.padding,
      required this.name,
      required this.time,
      required this.curriculum,
      this.fraction,
      this.fractionColor});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding,
      child: Row(
        children: [
          buildContent(name),
          buildContent(time, flex: 2),
          buildContent(curriculum, flex: 2),
          buildContent(fraction ?? "---", flex: 2, color: fractionColor),
        ],
      ),
    );
  }

  Widget buildContent(String data, {int? flex, Color? color}) {
    return Expanded(
      flex: flex ?? 1,
      child: Text(data,
          textAlign: TextAlign.center, style: TextStyle(color: color)),
    );
  }
}
